WTL Controls
Back to the WTL Controls Home Page.
BIS_WTL_CONTROLS Namespace Reference

Classes

class  CBevel
 A CStatic descendant which creates a single or two-tone beveled line, oriented horizontally or vertically. More...
 
class  CColorBlob
 A CStatic descendant providing customizable background color and edge style, but no text. More...
 
class  CComboBoxPlus
 A CComboBox descendant providing customizable background and text colors for both the edit and list box portions of the control. More...
 
class  CEditPlus
 A CEdit descendant, providing custom focused and non-focused colors via WM_CTLCOLOR variants. More...
 
class  CHyperlinkImage
 A CStatic descendant providing a context menu with a single entry, allowing the launch of the default browser to a pre - defined URL. More...
 
class  CODComboBox
 An owner-drawn combo box featuring textual content with per-item colors and fonts. More...
 
class  CODStatic
 An owner-drawn CStatic descendant, providing custom background and text colors and edge styles. More...
 
class  CStaticPlus
 A very simple CStatic enhancement, providing custom text and background colors. More...
 
class  CStatusBarPlus
 A CMultiPaneStatusBarCtrl descendant with a child CProgressBarCtrl that can be embedded in a user-selected pane. Default configuration creates a status bar with three panes, with the progress bar embedded in the third. Default pane IDs are ID_DEFAULT_PANE (defined as 0), 1 and 2. More...
 
class  CToolTipPlus
 A CToolTipCtrl descendant providing a couple added member functions making it easier and more convenient to use. More...
 

Enumerations

enum  CBevelMode { CBevelMode::bmVertical, CBevelMode::bmHorizontal }
 
enum  CBevelStyle { CBevelStyle::bsLine, CBevelStyle::bsRaised, CBevelStyle::bsSunken }
 
enum  CEdgeStyle { CEdgeStyle::esNone, CEdgeStyle::esLine, CEdgeStyle::esBump, CEdgeStyle::esEtched, CEdgeStyle::esRaised, CEdgeStyle::esSunken, CEdgeStyle::esThinRaised, CEdgeStyle::esThinSunken }
 Style of edge defining control boundaries. More...
 
enum  CHorzAlignment { CHorzAlignment::haLeft, CHorzAlignment::haCenter, CHorzAlignment::haRight }
 Control horizontal placement of text in control window. More...
 
enum  CVertAlignment { CVertAlignment::vaTop, CVertAlignment::vaMiddle, CVertAlignment::vaBottom }
 Control vertical placement of text in control window. More...
 
enum  CThemedBackgroundStyle { CThemedBackgroundStyle::tbPrimaryPanel, CThemedBackgroundStyle::tbMainInstructionPane, CThemedBackgroundStyle::tbContentPane, CThemedBackgroundStyle::tbSecondaryPanel, CThemedBackgroundStyle::tbControlPane }
 The CThemedBackgroundStyle enumerants correspond to select TaskDialog Parts, as indicated below. More...
 
enum  CThemedTextStyle { CThemedTextStyle::ttMainInstruction, CThemedTextStyle::ttInstruction, CThemedTextStyle::ttBodyTitle, CThemedTextStyle::ttBodyText, CThemedTextStyle::ttSecondaryText, CThemedTextStyle::ttLabel, CThemedTextStyle::ttControlLabel_Normal, CThemedTextStyle::ttControlLabel_Disabled }
 The CThemedTextStyle enumerants correspond to select TextStyle Parts and States, as indicated below. More...
 

Functions

BOOL OutlineRect (HDC HDestDC, const RECT &RDest)
 Draw a rectangular outline with the current pen. More...
 
CString Int_To_String (int value, int max_digits)
 Convert a multi-digit integer into a CString. More...
 
CString Double_To_String (double number, int precision)
 Convert a double to a CString, with a given number of significant digits. More...
 
double Sgn (double value)
 Test the sign of a double. More...
 
void GetLastErrorString ()
 Show a Message Box containing human-friendly information about the last failed system API call. More...
 
int GetCharHeight (HDC dc)
 Returns the height of a standard test string, in pixels. More...
 
int GetTextLineCount (HDC dc, CString text, int width, BOOL IsEditControl)
 Returns the number of lines of text required to fit a string in a given width. More...
 
int GetTextLength (CString str, HFONT font)
 Measure the length, in pixels, of a string using a given font. More...
 
BOOL FilePresent (LPCTSTR FullFileName)
 Tests for the presence of a file using SearchPath. More...
 
void DlgComboInit (int nDlgID, HWND DlgHwnd)
 Load combo boxes with strings stored in a resources file. More...
 

Enumeration Type Documentation

◆ CBevelMode

Enumerator
bmVertical 
bmHorizontal 

Definition at line 21 of file Bevel.h.

◆ CBevelStyle

Enumerator
bsLine 
bsRaised 
bsSunken 

Definition at line 22 of file Bevel.h.

◆ CEdgeStyle

Style of edge defining control boundaries.

Enumerator
esNone 
esLine 
esBump 
esEtched 
esRaised 
esSunken 
esThinRaised 
esThinSunken 

Definition at line 37 of file WTL_Controls.h.

◆ CHorzAlignment

Control horizontal placement of text in control window.

The CHorzAlignment enumerants are mapped to the DrawText API flags DT_LEFT, DT_CENTER and DT_RIGHT, respectively. See the MSDN DrawText documentation for more details.

Enumerator
haLeft 
haCenter 
haRight 

Definition at line 42 of file WTL_Controls.h.

◆ CVertAlignment

Control vertical placement of text in control window.

The CVertAlignment enumerants are mapped to the DrawText API flags DT_TOP, DT_VCENTER and DT_BOTTOM, respectively. See the MSDN DrawText documentation for more details.

Enumerator
vaTop 
vaMiddle 
vaBottom 

Definition at line 47 of file WTL_Controls.h.

◆ CThemedBackgroundStyle

The CThemedBackgroundStyle enumerants correspond to select TaskDialog Parts, as indicated below.

• CThemedBackgroundStyle::tbPrimaryPanel TDLG_PRIMARYPANEL
• CThemedBackgroundStyle::tbMainInstructionPane TDLG_MAININSTRUCTIONPANE
• CThemedBackgroundStyle::tbContentPane TDLG_CONTENTPANEL
• CThemedBackgroundStyle::tbSecondaryPanel TDLG_SECONDARYPANEL
• CThemedBackgroundStyle::tbControlPane TDLG_CONTROLPANE

For more information, see Parts and States in the MSDN Windows Controls Visual Styles Reference.

Enumerator
tbPrimaryPanel 
tbMainInstructionPane 
tbContentPane 
tbSecondaryPanel 
tbControlPane 

Definition at line 67 of file WTL_Controls.h.

◆ CThemedTextStyle

The CThemedTextStyle enumerants correspond to select TextStyle Parts and States, as indicated below.

EnumerantPartStyle
• CThemedTextStyle::ttMainInstruction TEXT_MAININSTRUCTION0
• CThemedTextStyle::ttInstruction TEXT_INSTRUCTION0
• CThemedTextStyle::ttBodyTitle TEXT_BODYTITLE0
• CThemedTextStyle::ttBodyText TEXT_BODYTEXT0
• CThemedTextStyle::ttSecondaryText TEXT_SECONDARYTEXT0
• CThemedTextStyle::ttLabel TEXT_LABEL0
• CThemedTextStyle::ttControlLabel_Normal TEXT_CONTROLLABELTS_CONTROLLABEL_NORMAL
• CThemedTextStyle::ttControlLabel_Disabled TEXT_CONTROLLABELTS_CONTROLLABEL_DISABLED

For more information, see Parts and States in the MSDN Windows Controls Visual Styles Reference.

Enumerator
ttMainInstruction 
ttInstruction 
ttBodyTitle 
ttBodyText 
ttSecondaryText 
ttLabel 
ttControlLabel_Normal 
ttControlLabel_Disabled 

Definition at line 94 of file WTL_Controls.h.

Function Documentation

◆ OutlineRect()

BOOL BIS_WTL_CONTROLS::OutlineRect ( HDC  HDestDC,
const RECT &  RDest 
)

Draw a rectangular outline with the current pen.

This wraps the GDI Rectangle function. A transparent brush is used as fill, leaving the outline, drawn with the pen currently selected in the device context.

Parameters
HDestDCDevice context in which to draw the rectangle.
RDestReference to a RECT structure with the coordinates to outline.
Return values
BOOLFalse (0) if the function fails, TRUE (non-zero) if it succeeds.

Definition at line 34 of file MiscFunctions.cpp.

◆ Int_To_String()

CString BIS_WTL_CONTROLS::Int_To_String ( int  value,
int  max_digits 
)

Convert a multi-digit integer into a CString.

This uses the C function _itot_s, then strips any leading zeros.

Parameters
valueThe integer to convert.
max_digitsThe maximum number of digits to convert.
Return values
CStringString representation of the first parameter.

Definition at line 68 of file MiscFunctions.cpp.

◆ Double_To_String()

CString BIS_WTL_CONTROLS::Double_To_String ( double  number,
int  precision 
)

Convert a double to a CString, with a given number of significant digits.

Wraps CString::Format, with the output converted to upper case.

Parameters
numberThe number to convert.
precisionThe desired number of significant digits.
Return values
CStringThe converted value.

Definition at line 98 of file MiscFunctions.cpp.

◆ Sgn()

double BIS_WTL_CONTROLS::Sgn ( double  value)

Test the sign of a double.

Quick sign check.

Parameters
valueThe number to test.
Return values
doubleReturns 0.0 is the input was 0.0, -1.0 if the input was less than zero and +1.0 if the input was greater than zero.

Definition at line 119 of file MiscFunctions.cpp.

◆ GetLastErrorString()

void BIS_WTL_CONTROLS::GetLastErrorString ( )

Show a Message Box containing human-friendly information about the last failed system API call.

Many C API calls will store error information available through the API GetLastError. The raw info returned isn't in a readable form; this function translates these values into text.

Definition at line 137 of file MiscFunctions.cpp.

◆ GetCharHeight()

int BIS_WTL_CONTROLS::GetCharHeight ( HDC  dc)

Returns the height of a standard test string, in pixels.

This wraps GetTextMetrics and returns the height in pixels of a character cell in the supplied device context, using the font currently selected into the context.

Parameters
dcThe device context to be examined.
Return values
intThe height, in pixels, of a character cell in the device context supplied as the sole parameter.

Definition at line 173 of file MiscFunctions.cpp.

◆ GetTextLineCount()

int BIS_WTL_CONTROLS::GetTextLineCount ( HDC  dc,
CString  text,
int  width,
BOOL  IsEditControl 
)

Returns the number of lines of text required to fit a string in a given width.

This function determines how many lines of text the GDI DrawText API will need to draw a given string, in a user-supplied device context, wrapping at a specified width.

Parameters
dcThe device context in which to measure the string.
textThe string to measure.
widthThe limit at which to wrap the text to the next line (in pixels).
IsEditControlIf TRUE, spaces words as if it were a multi-line edit control.
Return values
intThe number of rows of text that will result from using DrawText to write the given string.

Definition at line 197 of file MiscFunctions.cpp.

◆ GetTextLength()

int BIS_WTL_CONTROLS::GetTextLength ( CString  str,
HFONT  font 
)

Measure the length, in pixels, of a string using a given font.

The GDI function GetTextExtentPoint32 is used to measure the length of a string, in pixels, in a screen-compatible DC, with the supplied font.

Parameters
strThe string to measure.
fontThe font to use when measuring the string.
Return values
intThe length, in pixels.

Definition at line 233 of file MiscFunctions.cpp.

◆ FilePresent()

BOOL BIS_WTL_CONTROLS::FilePresent ( LPCTSTR  FullFileName)

Tests for the presence of a file using SearchPath.

Parameters
FullFileNameComplete path and file name to test.
Return values
BOOLReturns TRUE if found.

Definition at line 264 of file MiscFunctions.cpp.

◆ DlgComboInit()

void BIS_WTL_CONTROLS::DlgComboInit ( int  nDlgID,
HWND  DlgHwnd 
)

Load combo boxes with strings stored in a resources file.

There is a bug in ATL (through VS2017, anyway) that prevents combo boxes from loading strings defined at design time through the combo box's property pages. They will show up when the dialog is tested inside the IDE, but not at run time. Call this function from within the dialog's InitDialog handler and it will do the trick.

Parameters
nDlgIDThe resource ID of the dialog containing combo boxes to be loaded.
DlgHwndThe window handle of the dialog containing the combo boxes.

Definition at line 297 of file MiscFunctions.cpp.